/*
* Copyright (c) 2008, Vladimir Gumenuk
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*     * Redistributions of source code must retain the above copyright
*       notice, this list of conditions and the following disclaimer.
*     * Redistributions in binary form must reproduce the above copyright
*       notice, this list of conditions and the following disclaimer in the
*       documentation and/or other materials provided with the distribution.
*     * Neither the name of the copyright holder nor the
*       names of its contributors may be used to endorse or promote products
*       derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// RealGNX4LibView.cpp : implementation of the CRealGNX4LibView class
//

#include "stdafx.h"
#include "resource.h"
#include "RealGNX4Lib.h"

#include "RealGNX4LibDoc.h"
#include "RealGNX4LibView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

static const char *g_szAMPS[] = {
    "DIRECT    ",
    "BLACKFAC  ",
    "BOUTIQUE  ",
    "RECTFIED  ",
    "HOT ROD   ",
    "TWEED     ",
    "BRITCMBO  ",
    "CLEANTUB  ",
    "BRITSTCK  ",
    "CRUNCH    ",
    "HI GAIN   ",
    "BLUES     ",
    "MDRNGAIN  ",
    "FUZZ      ",
    "BASS MAN  ",
    "HIWATTAG  ",
    "ACOUSTIC  ",
    "ROCKBASS  ",
    "MDRNBASS  ",
    "BRITBASS  ",
    "SOLAR     ",
    "VINTAGE   ",
    "BOMBER    ",
    "BASIC     ",
    "DUALSHOW  ",
    "BOOGIMAN  ",
    "HARTKEY   ",
    "\0"
};

static const char *g_pszCABS[] = {
    "DIRECT    ",
    "AMER2X12  ",
    "BRIT4X12  ",
    "VNTG4X12  ",
    "BRIT2X12  ",
    "TWED1X12  ",
    "BLND2X12  ",
    "FANE4X12  ",
    "GRNB4X12  ",
    "BOTQ4X12  ",
    "AMER4X10  ",
    " 65 1X12  ",
    "JAZZ1X15  ",
    "BASS1X15  ",
    "BASS4X10  ",
    "BASS2X15  ",
    "FOLD1X18  ",
    "HART1X15  ",
    "BASIC 15H ",
    "VNTG8X10  ",
    "ASH 4X10  ",
    "GLTH4X10  ",
    "HART4X10  ",
    "\0"
};

// CRealGNX4LibView
IMPLEMENT_DYNCREATE(CRealGNX4LibView, CFormView)

BEGIN_MESSAGE_MAP(CRealGNX4LibView, CFormView)
    ON_CBN_SELCHANGE(IDC_WHAMMY_MODULE_CMB,OnSelChangeWhammyModule)
    ON_CBN_SELCHANGE(IDC_STOMPBOX_CMB, OnSelChangeStompBox)
    ON_CBN_SELCHANGE(IDC_GATE_TYPE_CMB, OnSelChangeNoiseGateType)
    ON_CBN_SELCHANGE(IDC_CHRUS_TYPE_CMB, OnSelChangeChorusModType)
END_MESSAGE_MAP()

// CRealGNX4LibView construction/destruction

CRealGNX4LibView::CRealGNX4LibView()
	: CFormView(CRealGNX4LibView::IDD)
    , m_iRadioCtrlAMomentary(0)
{
	m_iCurrentPresetIdx = 0;
}

CRealGNX4LibView::~CRealGNX4LibView()
{
}

void CRealGNX4LibView::DoDataExchange(CDataExchange* pDX)
{
    CFormView::DoDataExchange(pDX);
    DDX_Control( pDX, IDC_PRESETNAME_EDIT, m_editPresetName );
    DDX_Text( pDX, IDC_PRESETNAME_EDIT, m_csPresetName );
    DDV_MaxChars( pDX, m_csPresetName, 10 );
    DDX_Control( pDX, IDC_CHANNEL1_AMP_CMB, m_cmbChan1Amp );
    DDX_Control( pDX, IDC_CHANNEL1_CAB_CMB, m_cmbChan1Cab );
    DDX_Control( pDX, IDC_CHANNEL2_AMP_CMB, m_cmbChan2Amp );
    DDX_Control( pDX, IDC_CHANNEL2_CAB_CMB, m_cmbChan2Cab );

    m_editAmp1Gain.DataExchange( pDX, IDC_AMPGAIN1_EDIT, IDC_AMPGAIN1_SPIN );
    m_editAmp1Bass.DataExchange( pDX, IDC_AMP1_BASS_EDIT, IDC_AMP1_BASS_SPIN );
    m_editAmp1Middle.DataExchange( pDX, IDC_AMP1_MIDL_EDIT, IDC_AMP1_MIDL_SPIN );
    m_editAmp1Treble.DataExchange( pDX, IDC_AMP1_TREBLE_EDIT, IDC_AMP1_TREBLE_SPIN );
    m_editAmp1Level.DataExchange( pDX, IDC_AMP1_LEVEL_EDIT, IDC_AMP1_LEVEL_SPIN );
    m_editCab1Tune.DataExchange( pDX, IDC_CABTUNE1_EDIT, IDC_CABTUNE1_SPIN );
    m_editAmp1BassFreq.DataExchange( pDX, IDC_EQ1_BASS_EDIT, IDC_EQ1_BASS_SPIN );
    m_editAmp1MiddleFreq.DataExchange( pDX, IDC_EQ1_MIDL_EDIT, IDC_EQ1_MIDL_SPIN );
    m_editAmp1TrebleFreq.DataExchange( pDX, IDC_EQ1_TREBLE_EDIT, IDC_EQ1_TREBLE_SPIN );
    m_editAmp1Presence.DataExchange( pDX, IDC_EQ1_PRESENCE_EDIT, IDC_EQ1_PRESENCE_SPIN );

    m_editAmp2Gain.DataExchange( pDX, IDC_AMPGAIN2_EDIT, IDC_AMPGAIN2_SPIN );
    m_editAmp2Bass.DataExchange( pDX, IDC_AMP2_BASS_EDIT, IDC_AMP2_BASS_SPIN );
    m_editAmp2Middle.DataExchange( pDX, IDC_AMP2_MIDL_EDIT, IDC_AMP2_MIDL_SPIN );
    m_editAmp2Treble.DataExchange( pDX, IDC_AMP2_TREBLE_EDIT, IDC_AMP2_TREBLE_SPIN );
    m_editAmp2Level.DataExchange( pDX, IDC_AMP2_LEVEL_EDIT, IDC_AMP2_LEVEL_SPIN );
    m_editCab2Tune.DataExchange( pDX, IDC_CABTUNE2_EDIT, IDC_CABTUNE2_SPIN );
    m_editAmp2BassFreq.DataExchange( pDX, IDC_EQ2_BASS_EDIT, IDC_EQ2_BASS_SPIN );
    m_editAmp2MiddleFreq.DataExchange( pDX, IDC_EQ2_MIDL_EDIT, IDC_EQ2_MIDL_SPIN );
    m_editAmp2TrebleFreq.DataExchange( pDX, IDC_EQ2_TREBLE_EDIT, IDC_EQ2_TREBLE_SPIN );
    m_editAmp2Presence.DataExchange( pDX, IDC_EQ2_PRESENCE_EDIT, IDC_EQ2_PRESENCE_SPIN );

    DDX_Control(pDX, IDC_EQ1_ENABLE_CHK, m_chkEQ1);
    DDX_Control(pDX, IDC_EQ2_ENABLE_CHK, m_chkEQ2);
    DDX_Control(pDX, IDC_ACTIVECHANNEL_CMB, m_cmbActiveChannel);
    m_editWarpAmp.DataExchange( pDX, IDC_WARP_X_EDIT, IDC_WARP_X_SPIN );
    m_editWarpCab.DataExchange( pDX, IDC_WARP_Y_EDIT, IDC_WARP_Y_SPIN );
    m_editWarpZ.DataExchange( pDX, IDC_WARP_Z_EDIT, IDC_WARP_Z_SPIN );

    m_editPresetLevel.DataExchange( pDX, IDC_PRESETLEVEL_EDIT, IDC_PRESETLEVEL_SPIN );
    DDX_Control(pDX, IDC_WAH_CHK, m_chkWAH);
    DDX_Control(pDX, IDC_WAHTYPE_CMB, m_cmbWAHType);
    m_editWAHPedal.DataExchange( pDX, IDC_WAHPEDAL_EDIT, IDC_WAHPEDAL_SPIN );
    m_editWAHPedalMin.DataExchange( pDX, IDC_WAHPEDAL_MIN_EDIT, IDC_WAHPEDAL_MIN_SPIN );
    m_editWAHPedalMax.DataExchange( pDX, IDC_WAHPEDAL_MAX_EDIT, IDC_WAHPEDAL_MAX_SPIN );
    DDX_Control(pDX, IDC_PICKUPTYPE_CMB, m_cmbPickupType);
    DDX_Control(pDX, IDC_PICKUP_ENABLE_CHK, m_chkPickupEnable);

    DDX_Control(pDX, IDC_COMPRESSOR_CHK, m_chkCOMPEnable);
    DDX_Control(pDX, IDC_COMP_ATTACK_CMB, m_cmbCOMPAtack);
    DDX_Control(pDX, IDC_COMP_RATIO_CMB, m_cmbCOMPRatio);
    m_editCOMPThreshould.DataExchange( pDX, IDC_COMP_THRESH_EDIT, IDC_COMP_THRESH_SPIN );
    m_editCOMPGain.DataExchange( pDX, IDC_COMP_GAIN_EDIT, IDC_COMP_GAIN_SPIN );

    DDX_Control(pDX, IDC_WHAMMY_CHK, m_chkWHAMMYEnable);
    DDX_Control(pDX, IDC_WHAMMY_MODULE_CMB, m_cmbWHAMMYModule);
    DDX_Control(pDX, IDC_WHAMMY_PAR1_CMB, m_cmbWHAMMYPitchBend);
    m_editWHAMMYPedal.DataExchange( pDX, IDC_WHAMMY_PEDAL_EDIT, IDC_WHAMMY_PEDAL_SPIN );
    m_editWHAMMYLevel.DataExchange( pDX, IDC_WHAMMY_MIXLEVEL_EDIT, IDC_WHAMMY_MIXLEVEL_SPIN );
    DDX_Control(pDX, IDC_IPS_AMOUNT_CMB, m_cmbIPSAmount);
    DDX_Control(pDX, IDC_IPS_SCALE_CMB, m_cmbIPSScale);
    DDX_Control(pDX, IDC_COMBO7, m_cmbIPSKey);
    DDX_Control(pDX, IDC_WHAMMY_PARAM1_TXT, m_txtWHAMMYParam1);
    DDX_Control(pDX, IDC_WHAMMY_PARAM2_TXT, m_txtWHAMMYParam2);
    DDX_Control(pDX, IDC_IPS_KEY_TXT, m_txtIPSKey);
    DDX_Control(pDX, IDC_WHAMMY_LEVEL_TXT, m_txtWHAMMYLevel);
    m_editDETUNERAmount.DataExchange( pDX, IDC_DETUNER_AMPUNT_EDIT, IDC_DETUNER_AMOUNT_SPIN );

    DDX_Control(pDX, IDC_STOMPBOX_CHECK, m_chkSTOMPBOXEnable);
    DDX_Control(pDX, IDC_STOMPBOX_CMB, m_cmbSTOMPBOXType);
    m_editSTBOXGain.DataExchange( pDX, IDC_STOMPBOX_GAIN_EDIT, IDC_STOMPBOX_GAIN_SPIN );
    m_editSTBOXParam1.DataExchange( pDX, IDC_STOMPBOX_P1_EDIT, IDC_STOMPBOX_P1_SPIN );
    m_editSTBOXParam2.DataExchange( pDX, IDC_STOMPBOX_P2_EDIT, IDC_STOMPBOX_P2_SPIN );
    m_editSTBOXLoFreq.DataExchange( pDX, IDC_STOMPBOX_LOFREQ_EDIT, IDC_STOMPBOX_LOFREQ_SPIN );
    m_editSTBOXHiLevel.DataExchange( pDX, IDC_STOMPBOX_HIFREQ_EDIT, IDC_STOMPBOX_HIFREQ_SPIN );
    m_editSTBOXLevel.DataExchange( pDX, IDC_STOMPBOX_LEVEL_EDIT, IDC_STOMPBOX_LEVEL_SPIN );
    DDX_Control(pDX, IDC_STBOX_GAIN_TXT, m_txtSTBOXGain);
    DDX_Control(pDX, IDC_STOMPBOX_P1_STATIC, m_txtSTBOXParam1);
    DDX_Control(pDX, IDC_STOMPBOX_P2_STATIC, m_txtSTBOXParam2);
    DDX_Control(pDX, IDC_STOMPBOX_LOFREQ_STATIC, m_txtSTBOXLoFreq);
    DDX_Control(pDX, IDC_STOMPBOX_HIFREQ_STATIC, m_txtSTBOXHiLevel);

    DDX_Control(pDX, IDC_NOISEGATE_CHK, m_chkNGATEEnable);
    DDX_Control(pDX, IDC_GATE_TYPE_CMB, m_cmbNGATEType);
    m_editNGATEThresh.DataExchange( pDX, IDC_GATE_THRESHOULD_EDIT, IDC_GATE_THRESH_SPIN );
    m_editNGATEAttack.DataExchange( pDX, IDC_GATE_ATTACK_EDIT2, IDC_GATE_ATTACK_SPIN2 );
    m_editNGATESensitivity.DataExchange( pDX, IDC_GATE_SENSITIVITY_EDIT3, IDC_GATE_SENSITIVITY_SPIN3 );
    DDX_Control(pDX, IDC_PULCK_SENS_STATIC, m_txtPulckSensitivity);

    DDX_Control(pDX, IDC_CHRUS_TYPE_CMB, m_cmbMODType);
    DDX_Control(pDX, IDC_CHORUS_STATIC, m_txtMODParam1);
    DDX_Control(pDX, IDC_CHORUS_STATIC2, m_txtMODParam2);
    DDX_Control(pDX, IDC_CHORUS_STATIC3, m_txtMODParam3);
    DDX_Control(pDX, IDC_CHORUS_STATIC4, m_txtMODParam4);
    DDX_Control(pDX, IDC_CHORUS_STATIC5, m_txtMODParam5);
    m_editMODParam1.DataExchange( pDX, IDC_CHORUS_EDIT, IDC_CHORUS_SPIN );
    m_editMODParam2.DataExchange( pDX, IDC_CHORUS_EDIT2, IDC_CHORUS_SPIN2 );
    m_editMODParam3.DataExchange( pDX, IDC_CHORUS_EDIT3, IDC_CHORUS_SPIN3 );
    m_editMODParam4.DataExchange( pDX, IDC_CHORUS_EDIT4, IDC_CHORUS_SPIN4 );
    m_editMODParam5.DataExchange( pDX, IDC_CHORUS_EDIT5, IDC_CHORUS_SPIN5 );
    m_editMODLevel.DataExchange( pDX, IDC_CHORUS_EDIT6, IDC_CHORUS_SPIN6 );
    DDX_Control(pDX, IDC_CHORUSMOD_CHK, m_chkMODEnable);
    DDX_Control(pDX, IDC_CHORUS_STATIC6, m_txtMODLevel);
    DDX_Control(pDX, IDC_CHORUSMOD_WAVFRM_CMB, m_cmbMODWavFromType);

    DDX_Control(pDX, IDC_DELAY_CHK, m_chkDELAYEnable);
    DDX_Control(pDX, IDC_DELAY_TYPE_CMB, m_cmbDELAYType);
    m_editDELAYTime.DataExchange( pDX, IDC_DELAY_TIME_EDIT, IDC_DELAY_TIME_SPIN );
    m_editDELAYFeedback.DataExchange( pDX, IDC_DELAY_FEEDBACK_EDIT, IDC_DELAY_FEEDBACK_SPIN );
    m_editDELAYThresh.DataExchange( pDX, IDC_DELAY_THRESHOULD_EDIT, IDC_DELAY_THRESHOULD_SPIN );
    m_editDELAYAttenuation.DataExchange( pDX, IDC_DELAY_ATTENUATION_EDIT, IDC_DELAY_ATTENUATION_SPIN );
    m_editDELAYBalance.DataExchange( pDX, IDC_DELAY_BALANCE_EDIT, IDC_DELAY_BALANCE_SPIN );
    m_editDELAYSpread.DataExchange( pDX, IDC_DELAY_SPREAD_EDIT, IDC_DELAY_SPREAD_SPIN );
    m_editDELAYLevel.DataExchange( pDX, IDC_DELAY_LEVEL_EDIT, IDC_DELAY_LEVEL_SPIN );

    DDX_Control(pDX, IDC_REVERB_CHK, m_chkREVERBEnable);
    DDX_Control(pDX, IDC_REVERB_TYPE_CMB, m_cmbREVERBType);
    m_editREVERBPredelay.DataExchange( pDX, IDC_REVERB_PREDELAY_EDIT, IDC_REBERB_PREDELAY_SPIN );
    m_editREVERBDecay.DataExchange( pDX, IDC_REVERB_DECAY_EDIT, IDC_REVERB_DECAY_SPIN );
    m_editREVERBDumping.DataExchange( pDX, IDC_REVERB_DUMPING_EDIT, IDC_REVERB_DUMPING_SPIN );
    m_editREVERBBalance.DataExchange( pDX, IDC_REVERB_BALANCE_EDIT, IDC_REVERB_BALANCE_SPIN );
    m_editREVERBLevel.DataExchange( pDX, IDC_REVERB_LEVEL_EDIT, IDC_REVERB_LEVEL_SPIN );

    DDX_Control(pDX, IDC_EXPPDL1_CMB, m_cmbEXPPdl1Assgn);
    DDX_Control(pDX, IDC_EXPPDL2_CMB, m_cmbEXPPdl2Assgn);
    DDX_Control(pDX, IDC_EXPPDL3_CMB, m_cmbEXPPdl3Assgn);
    m_editExpPdl1Min.DataExchange( pDX, IDC_EXPPDL1_MIN_EDIT, IDC_EXPPDL1_MIN_SPIN );
    m_editExpPdl1Max.DataExchange( pDX, IDC_EXPPDL1_MAX_EDIT, IDC_EXPPDL1_MAX_SPIN );
    m_editExpPdl2Min.DataExchange( pDX, IDC_EXPPDL2_MIN_EDIT, IDC_EXPPDL2_MIN_SPIN );
    m_editExpPdl2Max.DataExchange( pDX, IDC_EXPPDL2_MAX_EDIT, IDC_EXPPDL2_MAX_SPIN );
    m_editExpPdl3Min.DataExchange( pDX, IDC_EXPPDL3_MIN_EDIT, IDC_EXPPDL3_MIN_SPIN );
    m_editExpPdl3Max.DataExchange( pDX, IDC_EXPPDL3_MAX_EDIT, IDC_EXPPDL3_MAX_SPIN );

    DDX_Control(pDX, IDC_LFO1_CMB, m_cmbLFO1);
    DDX_Control(pDX, IDC_LFO2_CMB2, m_cmbLFO2);
    DDX_Control(pDX, IDC_LFO1_WAVFRM_CMB, m_cmbLFO1WavFrm);
    DDX_Control(pDX, IDC_LFO2_WAVFRM_CMB, m_cmbLFO2WavFrm);
    m_editLFO1Min.DataExchange( pDX, IDC_LFO1_MIN_EDIT, IDC_LFO1_MIN_SPIN );
    m_editLFO1Max.DataExchange( pDX, IDC_LFO1_MAX_EDIT, IDC_LFO1_MAX_SPIN );
    m_editLFO1Speed.DataExchange( pDX, IDC_LFO1_SPEED_EDIT, IDC_LFO1_SPEED_SPIN );
    m_editLFO2Min.DataExchange( pDX, IDC_LFO2_MIN_EDIT, IDC_LFO2_MIN_SPIN );
    m_editLFO2Max.DataExchange( pDX, IDC_LFO2_MAX_EDIT, IDC_LFO2_MAX_SPIN );
    m_editLFO2Speed.DataExchange( pDX, IDC_LFO2_SPEED_EDIT, IDC_LFO2_SPEED_SPIN );

    DDX_Control(pDX, IDC_CTRLA_LNK1_CMB, m_cmbCtrlALink1Type);
    m_editCtrlALink1Min.DataExchange( pDX, IDC_CTRLA_LNK1_MIN_EDIT, IDC_CTRLA_LNK1_MIN_SPIN );
    m_editCtrlALink1Max.DataExchange( pDX, IDC_CTRLA_LNK1_MAX_EDIT, IDC_CTRLA_LNK1_MAX_SPIN );
    DDX_Control(pDX, IDC_CTRLA_LNK2_CMB, m_cmbCtrlALink2Type);
    m_editCtrlALink2Min.DataExchange( pDX, IDC_CTRLA_LNK2_MIN_EDIT, IDC_CTRLA_LNK2_MIN_SPIN );
    m_editCtrlALink2Max.DataExchange( pDX, IDC_CTRLA_LNK2_MAX_EDIT, IDC_CTRLA_LNK2_MAX_SPIN );
    DDX_Control(pDX, IDC_CTRLA_LNK3_CMB, m_cmbCtrlALink3Type);
    m_editCtrlALink3Min.DataExchange( pDX, IDC_CTRLA_LNK3_MIN_EDIT, IDC_CTRLA_LNK3_MIN_SPIN );
    m_editCtrlALink3Max.DataExchange( pDX, IDC_CTRLA_LNK3_MAX_EDIT, IDC_CTRLA_LNK3_MAX_SPIN );
    DDX_Control(pDX, IDC_CTRLA_TOGGLE_RADIO, m_radioCtrlAToggle);
    DDX_Control(pDX, IDC_CTRLB_LNK2_CMB, m_cmbCtrlBLink2Type);
    DDX_Control(pDX, IDC_CTRLB_LNK3_CMB, m_cmbCtrlBLink3Type);
    DDX_Control(pDX, IDC_CTRLB_LNK1_CMB, m_cmbCtrlBLink1Type);
    m_editCtrlBLink1Min.DataExchange( pDX, IDC_CTRLB_LNK1_MIN_EDIT, IDC_CTRLB_LNK1_MIN_SPIN );
    m_editCtrlBLink1Max.DataExchange( pDX, IDC_CTRLB_LNK1_MAX_EDIT, IDC_CTRLB_LNK1_MAX_SPIN );
    m_editCtrlBLink2Min.DataExchange( pDX, IDC_CTRLB_LNK2_MIN_EDIT, IDC_CTRLB_LNK2_MIN_SPIN );
    m_editCtrlBLink2Max.DataExchange( pDX, IDC_CTRLB_LNK2_MAX_EDIT, IDC_CTRLB_LNK2_MAX_SPIN );
    m_editCtrlBLink3Min.DataExchange( pDX, IDC_CTRLB_LNK3_MIN_EDIT, IDC_CTRLB_LNK3_MIN_SPIN );
    m_editCtrlBLink3Max.DataExchange( pDX, IDC_CTRLB_LNK3_MAX_EDIT, IDC_CTRLB_LNK3_MAX_SPIN );
    DDX_Control(pDX, IDC_CTRLC_LNK1_CMB, m_cmbCtrlCLink1Type);
    DDX_Control(pDX, IDC_CTRLC_LNK2_CMB, m_cmbCtrlCLink2Type);
    DDX_Control(pDX, IDC_CTRLC_LNK3_CMB, m_cmbCtrlCLink3Type);
    m_editCtrlCLink1Min.DataExchange( pDX, IDC_CTRLC_LNK1_MIN_EDIT, IDC_CTRLC_LNK1_MIN_SPIN );
    m_editCtrlCLink1Max.DataExchange( pDX, IDC_CTRLC_LNK1_MAX_EDIT, IDC_CTRLC_LNK1_MAX_SPIN );
    m_editCtrlCLink2Min.DataExchange( pDX, IDC_CTRLC_LNK2_MIN_EDIT, IDC_CTRLC_LNK2_MIN_SPIN );
    m_editCtrlCLink2Max.DataExchange( pDX, IDC_CTRLC_LNK2_MAX_EDIT, IDC_CTRLC_LNK2_MAX_SPIN );
    m_editCtrlCLink3Min.DataExchange( pDX, IDC_CTRLC_LNK3_MIN_EDIT, IDC_CTRLC_LNK3_MIN_SPIN );
    m_editCtrlCLink3Max.DataExchange( pDX, IDC_CTRLC_LNK3_MAX_EDIT, IDC_CTRLC_LNK3_MAX_SPIN );
}

BOOL CRealGNX4LibView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
 
	return CFormView::PreCreateWindow(cs);
}

void CRealGNX4LibView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	ResizeParentToFit();
    InitCombos();

    m_editAmp1Gain.Initialize( 0, 99 );
    m_editAmp1Bass.Initialize( -12, 12 );
    m_editAmp1Middle.Initialize( -12, 12 );
    m_editAmp1Treble.Initialize( -12, 12 );
    m_editAmp1Level.Initialize( 0, 99 );
    m_editCab1Tune.Initialize( -12.0f, 12.0f, 0, 48 );
    m_editAmp1BassFreq.Initialize( 50, 300 );
    m_editAmp1MiddleFreq.Initialize( 300, 5000 );
    m_editAmp1TrebleFreq.Initialize( 500, 8000 );
    m_editAmp1Presence.Initialize( 0, 99 );
    m_editAmp2Gain.Initialize( 0, 99 );
    m_editAmp2Bass.Initialize( -12, 12 );
    m_editAmp2Middle.Initialize( -12, 12 );
    m_editAmp2Treble.Initialize( -12, 12 );
    m_editAmp2Level.Initialize( 0, 99 );
    m_editCab2Tune.Initialize( -12.0f, 12.0f, 0, 48 );
    m_editAmp2BassFreq.Initialize( 50, 300 );
    m_editAmp2MiddleFreq.Initialize( 300, 5000 );
    m_editAmp2TrebleFreq.Initialize( 500, 8000 );
    m_editAmp2Presence.Initialize( 0, 99 );
    m_editWarpAmp.Initialize( 0, 99 );
    m_editWarpCab.Initialize( 0, 99 );
    m_editWarpZ.Initialize( 0, 99 );
    m_editWAHPedal.Initialize( 0, 99 );
    m_editWAHPedalMin.Initialize( 0, 99 );
    m_editWAHPedalMax.Initialize( 0, 99 );
    m_editPresetLevel.Initialize( 0, 99 );
    m_editCOMPThreshould.Initialize( 0, 99 );
    m_editCOMPGain.Initialize( 0, 20 );
    m_editWHAMMYPedal.Initialize( 0, 99 );
    m_editWHAMMYLevel.Initialize( 0, 99 );
    m_editDETUNERAmount.Initialize( -24, 24 );
    m_editSTBOXGain.Initialize( 0, 99 );
    m_editSTBOXParam1.Initialize( 0, 99 );
    m_editSTBOXParam2.Initialize( 0, 99 );
    m_editSTBOXLoFreq.Initialize( 0, 99 );
    m_editSTBOXHiLevel.Initialize( 0, 99 );
    m_editSTBOXLevel.Initialize( 0, 99 );
    m_editNGATEThresh.Initialize( 0, 99 );
    m_editNGATEAttack.Initialize( 0, 9 );
    m_editNGATESensitivity.Initialize( 0, 99 );
    m_editMODParam1.Initialize( 0, 99 );
    m_editMODParam2.Initialize( 0, 99 );
    m_editMODParam3.Initialize( 0, 99 );
    m_editMODParam4.Initialize( 0, 99 );
    m_editMODParam5.Initialize( 0, 99 );
    m_editMODLevel.Initialize( 0, 99 );
    m_editDELAYTime.Initialize( 0, 2000 );
    m_editDELAYFeedback.Initialize( 0, 100 );
    m_editDELAYThresh.Initialize( 0, 100 );
    m_editDELAYAttenuation.Initialize( 0, 99 );
    m_editDELAYBalance.Initialize( -99, 99 );
    m_editDELAYSpread.Initialize( 1, 50 );
    m_editDELAYLevel.Initialize( 0, 99 );
    m_editREVERBPredelay.Initialize( 0, 15 );
    m_editREVERBDecay.Initialize( 0, 99 );
    m_editREVERBDumping.Initialize( 0, 99 );
    m_editREVERBBalance.Initialize( -99, 99 );
    m_editREVERBLevel.Initialize( 0, 99 );
    m_editExpPdl1Min.Initialize( 0, 99 );
    m_editExpPdl1Max.Initialize( 0, 99 );
    m_editExpPdl2Min.Initialize( 0, 99 );
    m_editExpPdl2Max.Initialize( 0, 99 );
    m_editExpPdl3Min.Initialize( 0, 99 );
    m_editExpPdl3Max.Initialize( 0, 99 );
    m_editLFO1Min.Initialize( 0, 99 );
    m_editLFO1Max.Initialize( 0, 99 );
    m_editLFO1Speed.Initialize( 0, 0xB9 );
    m_editLFO2Min.Initialize( 0, 99 );
    m_editLFO2Max.Initialize( 0, 99 );
    m_editLFO2Speed.Initialize( 0, 0xB9 );
    m_editCtrlALink1Min.Initialize( 0, 99 );
    m_editCtrlALink1Max.Initialize( 0, 99 );
    m_editCtrlALink2Min.Initialize( 0, 99 );
    m_editCtrlALink2Max.Initialize( 0, 99 );
    m_editCtrlALink3Min.Initialize( 0, 99 );
    m_editCtrlALink3Max.Initialize( 0, 99 );
    m_editCtrlBLink1Min.Initialize( 0, 99 );
    m_editCtrlBLink1Max.Initialize( 0, 99 );
    m_editCtrlBLink2Min.Initialize( 0, 99 );
    m_editCtrlBLink2Max.Initialize( 0, 99 );
    m_editCtrlBLink3Min.Initialize( 0, 99 );
    m_editCtrlBLink3Max.Initialize( 0, 99 );
    m_editCtrlCLink1Min.Initialize( 0, 99 );
    m_editCtrlCLink1Max.Initialize( 0, 99 );
    m_editCtrlCLink2Min.Initialize( 0, 99 );
    m_editCtrlCLink2Max.Initialize( 0, 99 );
    m_editCtrlCLink3Min.Initialize( 0, 99 );
    m_editCtrlCLink3Max.Initialize( 0, 99 );

    UpdateView( 0 );
}

void CRealGNX4LibView::InitCombos()
{
    DWORD i = 0;
    const char *psz = g_szAMPS[i];
    do 
    {
        m_cmbChan1Amp.AddString( psz );
        m_cmbChan2Amp.AddString( psz );
        psz = g_szAMPS[++i];
    } while( *psz != '\0' );


    i = 0;
    psz = g_pszCABS[i];
    do 
    {
        m_cmbChan1Cab.AddString( psz );
        m_cmbChan2Cab.AddString( psz );
        psz = g_pszCABS[++i];
    } while( *psz != '\0' );

    // TODO: Get rid from this:
    m_cmbEXPPdl1Assgn.AddString( "Unknown" );
    m_cmbEXPPdl2Assgn.AddString( "Unknown" );
    m_cmbEXPPdl3Assgn.AddString( "Unknown" );
    m_cmbLFO1.AddString( "Unknown" );
    m_cmbLFO2.AddString( "Unknown" );
    m_cmbCtrlALink1Type.AddString( "Unknown" );
    m_cmbCtrlALink2Type.AddString( "Unknown" );
    m_cmbCtrlALink3Type.AddString( "Unknown" );
}
// CRealGNX4LibView diagnostics

#ifdef _DEBUG
void CRealGNX4LibView::AssertValid() const
{
	CFormView::AssertValid();
}

void CRealGNX4LibView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CRealGNX4LibDoc* CRealGNX4LibView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRealGNX4LibDoc)));
	return (CRealGNX4LibDoc*)m_pDocument;
}
#endif //_DEBUG


// CRealGNX4LibView message handlers

void CRealGNX4LibView::OnPresetSelected( UINT iIdx )
{
    //TRACE( _T("CRealGNX4LibView::OnPresetSelected -> %d\n"), iIdx );
    UpdateView( iIdx );
}

void CRealGNX4LibView::UpdateView( UINT iPresetIdx )
{
    CRealGNX4LibDoc* pDoc = GetDocument();
    LPPRESET p = pDoc->GetPreset( iPresetIdx );
    if( !p )
        return;

    m_iCurrentPresetIdx = iPresetIdx;

    USES_CONVERSION;
    if( !IsWindow( m_editPresetName.GetSafeHwnd() ) )
        return;

    int iIdx = 0;
    m_editPresetName.SetWindowText( W2T(p->wszName) );

    if( CB_ERR == m_cmbChan1Amp.SelectString( -1, W2T(p->Amp1.wszName) ) ) // means we have custom named amp/cabinet
    {
        iIdx = m_cmbChan1Amp.AddString( W2T(p->Amp1.wszName) );
        m_cmbChan1Amp.SetCurSel( iIdx );
    }

    if( CB_ERR == m_cmbChan2Amp.SelectString( -1, W2T(p->Amp2.wszName) ) )
    {
        iIdx = m_cmbChan2Amp.AddString( W2T(p->Amp2.wszName) );
        m_cmbChan2Amp.SetCurSel( iIdx );
    }

    if( CB_ERR == m_cmbChan1Cab.SelectString( -1, W2T(p->wszCab1Name) ) )
    {
        iIdx = m_cmbChan1Cab.AddString( W2T(p->wszCab1Name) );
        m_cmbChan1Cab.SetCurSel( iIdx );
    }

    if( CB_ERR == m_cmbChan2Cab.SelectString( -1, W2T(p->wszCab2Name) ) )
    {
        iIdx = m_cmbChan2Cab.AddString( W2T(p->wszCab2Name) );
        m_cmbChan2Cab.SetCurSel( iIdx );
    }

    m_editAmp1Gain.Value        = p->wGreen_TONEAMP_Gain;
    m_editAmp1Bass.Value        = p->wGreen_TONE_BASS - 12;
    m_editAmp1Middle.Value      = p->wGreen_TONE_Midrange - 12;
    m_editAmp1Treble.Value      = p->wGreen_TONE_TREBE - 12;
    m_editAmp1Level.Value       = p->wGreen_TONEAMP_Level;
    m_editCab1Tune.fValue       = float( p->wGreen_CABTUNE - 24 ) / 2.0f;
    m_editAmp1BassFreq.Value    = p->wGreen_BASS_Freq + 50;
    m_editAmp1MiddleFreq.Value  = p->wGreen_MID_Freq + 300;
    m_editAmp1TrebleFreq.Value  = p->wGreen_TREB_Freq + 500;
    m_editAmp1Presence.Value    = p->wGreen_Presence;
    m_chkEQ1.Initialize( &p->wGreen_EQUALIZER_OnOff );

    m_editAmp2Gain.Value        = p->wRed_TONEAMP_Gain;
    m_editAmp2Bass.Value        = p->wRed_TONE_BASS - 12;
    m_editAmp2Middle.Value      = p->wRed_TONE_Midrange - 12;
    m_editAmp2Treble.Value      = p->wRed_TONE_TREBE - 12;
    m_editAmp2Level.Value       = p->wRed_TONEAMP_Level;
    m_editCab2Tune.fValue       = float( p->wRed_CABTUNE - 24 ) / 2.0f;
    m_editAmp2BassFreq.Value    = p->wRed_BASS_Freq + 50;
    m_editAmp2MiddleFreq.Value  = p->wRed_MID_Freq + 300;
    m_editAmp2TrebleFreq.Value  = p->wRed_TREB_Freq + 500;
    m_editAmp2Presence.Value    = p->wRed_Presence;
    m_chkEQ2.Initialize( &p->wRed_EQUALIZER_OnOff );

    m_cmbActiveChannel.SetCurSel( p->wActiveChanel );
    m_editWarpAmp.Value         = p->wWARPX;
    m_editWarpCab.Value         = p->wWARPY;
    m_editWarpZ.Value           = p->wWARPZ;

    m_chkWAH.Initialize( &p->wWAH_OnOff );
    m_cmbWAHType.SetCurSel( p->wWAH_Type );
    m_editWAHPedal.Value        = p->wWAH_Pedal;
    m_editWAHPedalMin.Value     = p->wWAH_Pdl1_Min;
    m_editWAHPedalMax.Value     = p->wWAH_Pdl1_Max;
    m_chkPickupEnable.Initialize( &p->wPICKUP_OnOff );
    m_cmbPickupType.SetCurSel( p->wPICKUP_Type );
    m_editPresetLevel.Value     = p->wPresetLevel;

    m_chkCOMPEnable.Initialize( &p->wCOMPRESSOR_OnOff );
    m_cmbCOMPAtack.SetCurSel( p->wCOMPRESSOR_Atack );
    m_cmbCOMPRatio.SetCurSel( p->wCOMPRESSOR_Ratio );
    m_editCOMPThreshould.Value  = p->wCOMPRESSOR_Threshould;
    m_editCOMPGain.Value        = p->wCOMPRESSOR_Gain;

    UpdateWhammyModView( p );
    UpdateSompBoxView( p );
    UpdateNoiseGateView( p );
    UpdateChorusModView( p );
    UpdateDelayView( p );
    UpdateReverbView( p );
    UpdateExpPdlView( p );
    UpdateLFOView( p );
    UpdateCtrlAView( p );
}

void CRealGNX4LibView::UpdateWhammyModView( LPPRESET p )
{
    m_chkWHAMMYEnable.Initialize( &p->wWHAMMY_IPS_TALK_OnOff );
    m_cmbWHAMMYModule.SetCurSel( p->wWHAMMY_IPS_TALK_Selection );

    m_txtWHAMMYParam1;
    m_txtWHAMMYParam2;
    m_txtIPSKey;

    switch( p->wWHAMMY_IPS_TALK_Selection )
    {
    case 0: // whammy
        m_cmbIPSAmount.ShowWindow( SW_HIDE );
        m_cmbIPSScale.ShowWindow( SW_HIDE );
        m_cmbIPSKey.ShowWindow( SW_HIDE );
        m_txtIPSKey.ShowWindow( SW_HIDE );
        m_editDETUNERAmount.Visible = FALSE;
        m_txtWHAMMYParam1.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam2.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam1.SetWindowText( "Pitch bend:" );
        m_txtWHAMMYParam2.SetWindowText( "Pedal:" );
        m_txtWHAMMYLevel.SetWindowText( "Mix Level:" );
        m_cmbWHAMMYPitchBend.ShowWindow( SW_SHOW );
        m_editWHAMMYPedal.Visible = TRUE;
        m_cmbWHAMMYPitchBend.SetCurSel( p->wWHAMMY_Parameter1 );
        m_editWHAMMYPedal.Value = p->wWHAMMY_Parameter2;
        break;

    case 1: // ips
        m_cmbWHAMMYPitchBend.ShowWindow( SW_HIDE );
        m_editWHAMMYPedal.Visible = FALSE;
        m_editDETUNERAmount.Visible = FALSE;
        m_txtWHAMMYParam1.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam2.ShowWindow( SW_SHOW );
        m_cmbIPSAmount.ShowWindow( SW_SHOW );
        m_cmbIPSScale.ShowWindow( SW_SHOW );
        m_cmbIPSKey.ShowWindow( SW_SHOW );
        m_txtIPSKey.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam1.SetWindowText( "Amount:" );
        m_txtWHAMMYParam2.SetWindowText( "Scale:" );
        m_txtWHAMMYLevel.SetWindowText( "IPS Level:" );
        m_cmbIPSAmount.SetCurSel( p->wWHAMMY_Parameter1 );
        m_cmbIPSScale.SetCurSel( p->wWHAMMY_Parameter2 );
        m_cmbIPSKey.SetCurSel( p->wIPS_Key );
        break;

    case 2: // detuner
        m_cmbIPSAmount.ShowWindow( SW_HIDE );
        m_cmbIPSScale.ShowWindow( SW_HIDE );
        m_cmbIPSKey.ShowWindow( SW_HIDE );
        m_txtIPSKey.ShowWindow( SW_HIDE );
        m_cmbWHAMMYPitchBend.ShowWindow( SW_HIDE );
        m_editWHAMMYPedal.Visible = FALSE;
        m_txtWHAMMYParam2.ShowWindow( SW_HIDE );
        m_txtWHAMMYParam1.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam1.SetWindowText( "Amount:" );
        m_txtWHAMMYLevel.SetWindowText( "DTN Level:" );
        m_editDETUNERAmount.Visible = TRUE;
        m_editDETUNERAmount.Value = p->wWHAMMY_Parameter1;
        break;

    case 3: // pitch
        m_cmbIPSAmount.ShowWindow( SW_HIDE );
        m_cmbIPSScale.ShowWindow( SW_HIDE );
        m_cmbIPSKey.ShowWindow( SW_HIDE );
        m_txtIPSKey.ShowWindow( SW_HIDE );
        m_cmbWHAMMYPitchBend.ShowWindow( SW_HIDE );
        m_editWHAMMYPedal.Visible = FALSE;
        m_txtWHAMMYParam1.ShowWindow( SW_SHOW );
        m_txtWHAMMYParam2.ShowWindow( SW_HIDE );
        m_txtWHAMMYParam1.SetWindowText( "Shift:" );
        m_txtWHAMMYLevel.SetWindowText( "PCH Level:" );
        m_editDETUNERAmount.Visible = TRUE;
        m_editDETUNERAmount.Value = p->wWHAMMY_Parameter1;
        break;

    case 4: case 5: case 6: case 7: case 8: // talker 1 - 5
        m_cmbIPSAmount.ShowWindow( SW_HIDE );
        m_cmbIPSScale.ShowWindow( SW_HIDE );
        m_cmbIPSKey.ShowWindow( SW_HIDE );
        m_txtIPSKey.ShowWindow( SW_HIDE );
        m_cmbWHAMMYPitchBend.ShowWindow( SW_HIDE );
        m_editWHAMMYPedal.Visible = FALSE;
        m_txtWHAMMYParam1.ShowWindow( SW_HIDE );
        m_txtWHAMMYParam2.ShowWindow( SW_HIDE );
        m_editDETUNERAmount.Visible = FALSE;
        m_txtWHAMMYLevel.SetWindowText( "MIC Level:" );
        break;
    }
 
    m_editWHAMMYLevel.Value = p->wWHAMMY_IPS_PITCH_DETUNER_Level;
}

void CRealGNX4LibView::UpdateSompBoxView( LPPRESET p )
{
    m_chkSTOMPBOXEnable.Initialize( &p->wSTOMPBOX_OnOff );
    m_cmbSTOMPBOXType.SetCurSel( p->wSTOMPBOX_Type );
    m_editSTBOXGain.Value   = p->wSTOMPBOX_Gain;
    m_editSTBOXParam1.Value = p->wSTOMPBOX_Param1;
    m_editSTBOXParam2.Value = p->wSTOMPBOX_Param2;
    m_editSTBOXLoFreq.Value = p->wMZONE_LowFreq;
    m_editSTBOXHiLevel.Value = p->wMZONE_HiLevel;
    m_editSTBOXLevel.Value  = p->wSTOMPBOX_Level;

    switch( p->wSTOMPBOX_Type )
    {
    case 0: // screamer
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Drive:" );
        m_txtSTBOXParam1.SetWindowText( "Tone:" );
        break;
    case 1: // rodent
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Dist:" );
        m_txtSTBOXParam1.SetWindowText( "Filter:" );
        break;
    case 2: // ds dist
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Dist:" );
        m_txtSTBOXParam1.SetWindowText( "Tone:" );
        break;
    case 3: // dod 250
        m_txtSTBOXParam1.ShowWindow( SW_HIDE );
        m_editSTBOXParam1.Visible = FALSE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Gain:" );
        break;
    case 4: // big mp
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Sustain:" );
        m_txtSTBOXParam1.SetWindowText( "Tone:" );
        break;
    case 5: // guy od
        m_txtSTBOXParam1.ShowWindow( SW_HIDE );
        m_editSTBOXParam1.Visible = FALSE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Drive:" );
        break;
    case 6: // spark drv
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_SHOW );
        m_editSTBOXParam2.Visible = TRUE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Gain:" );
        m_txtSTBOXParam1.SetWindowText( "Tone:" );
        m_txtSTBOXParam2.SetWindowText( "Clean:" );
        break;
    case 7: // grunge
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_SHOW );
        m_editSTBOXParam2.Visible = TRUE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Gain:" );
        m_txtSTBOXParam1.SetWindowText( "Butt:" );
        m_txtSTBOXParam2.SetWindowText( "Face:" );
        break;
    case 8: // fuzzy
        m_txtSTBOXParam1.ShowWindow( SW_HIDE );
        m_editSTBOXParam1.Visible = FALSE;
        m_txtSTBOXParam2.ShowWindow( SW_HIDE );
        m_editSTBOXParam2.Visible = FALSE;
        m_txtSTBOXLoFreq.ShowWindow( SW_HIDE );
        m_editSTBOXLoFreq.Visible = FALSE;
        m_txtSTBOXHiLevel.ShowWindow( SW_HIDE );
        m_editSTBOXHiLevel.Visible = FALSE;
        m_txtSTBOXGain.SetWindowText( "Fuzz:" );
        break;
    case 9: // zone
        m_txtSTBOXParam1.ShowWindow( SW_SHOW );
        m_editSTBOXParam1.Visible = TRUE;
        m_txtSTBOXParam2.ShowWindow( SW_SHOW );
        m_editSTBOXParam2.Visible = TRUE;
        m_txtSTBOXLoFreq.ShowWindow( SW_SHOW );
        m_editSTBOXLoFreq.Visible = TRUE;
        m_txtSTBOXHiLevel.ShowWindow( SW_SHOW );
        m_editSTBOXHiLevel.Visible = TRUE;
        m_txtSTBOXGain.SetWindowText( "Dist:" );
        m_txtSTBOXParam1.SetWindowText( "MidFrq:" );
        m_txtSTBOXParam2.SetWindowText( "MidLvl:" );
        break;
    }
}

void CRealGNX4LibView::UpdateNoiseGateView( LPPRESET p )
{
    m_chkNGATEEnable.Initialize( &p->wNOISEGATE_OnOff );
    m_cmbNGATEType.SetCurSel( p->wNOISEGATE_Type );
    m_editNGATEThresh.Value = p->wNOISEGATE_Threshould;
    m_editNGATEAttack.Value = p->wNOISEGATE_Attack;
    m_editNGATESensitivity.Value = p->wNOISEGATE_Pluck_Sensitivity;

    if( p->wNOISEGATE_Type == 1 ) // pluck
    {
        m_txtPulckSensitivity.ShowWindow( SW_SHOW );
        m_editNGATESensitivity.Visible = TRUE;
    }
    else
    {
        m_txtPulckSensitivity.ShowWindow( SW_HIDE );
        m_editNGATESensitivity.Visible = FALSE;
    }
}

void CRealGNX4LibView::UpdateChorusModView( LPPRESET p )
{
    struct MODInfo
    {
        LPCSTR lpsz1, lpsz2, lpsz3, lpsz4, lpsz5;
        int    iWavFrmPlace;
        int    iS1, iS2, iS3, iS4, iS5, iS6;
    };
    static const MODInfo MOD[15] = {
        // chorus
        "Speed:",   "Depth:",   "Predelay:",  "WavFrm:",  "Balance:", 4,            
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_SHOW,    SW_SHOW,
        // flanger
        "Speed:",   "Depth:",   "Regen:",     "",         "",         0,            
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_SHOW,
        // phaser
        "Speed:",   "Sensity:", "Regen:",     "WavFrm:",  "Balance:", 4,             
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_SHOW,    SW_SHOW,
        // Triggered Flanger
        "Speed:",   "Sensity:", "LFO start:", "",         "",         0,            
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_SHOW,
        // Triggered Phaser
        "Speed:",   "Sensity:", "LFO start:", "",         "",         0,          
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_SHOW,
        // Tremolo
        "Speed:",   "Depth:",   "WavFrm:",    "",         "",         3,          
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_HIDE,
        // Panner
        "Speed:",   "Depth:",   "WavFrm:",    "",         "",         3,          
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_HIDE,
        // Vibrato
        "Speed:",   "Depth:",   "WavFrm:",    "",         "",         3,          
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_HIDE,
        // Rotary Speaker                                 |this should be Balance??? - missed in documentation!!!
        "Speed:",   "Depth:",   "Doppler:",   "CrosFr:",  "",         0,          
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_HIDE,    SW_HIDE,
        // AutoYa
        "Speed:",   "Depth:",   "Range:",     "Balance:", "",         0,
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_HIDE,    SW_SHOW,
        // YaYa
        "YaPedal:", "Depth:",   "Range:",     "Balance:", "",         0,
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_HIDE,    SW_SHOW,
        // SynthTalk
        "Attack:",  "Release:", "Vox:",       "Balance:", "",         0,
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_SHOW,    SW_HIDE,    SW_SHOW,
        // Envelope Filter
        "Sensity:", "Range:",   "Balance:",   "",         "",         0,
        SW_SHOW,    SW_SHOW,    SW_SHOW,      SW_HIDE,    SW_HIDE,    SW_SHOW,
        // Detune
        "Amount:", "Balance:",  "",           "",         "",         0,
        SW_SHOW,   SW_SHOW,     SW_HIDE,      SW_HIDE,    SW_HIDE,    SW_SHOW,
        // Pitch Shift
        "Shift:", "Balance:",  "",           "",         "",          0,
        SW_SHOW,   SW_SHOW,     SW_HIDE,      SW_HIDE,    SW_HIDE,    SW_SHOW,
    };

    m_chkMODEnable.Initialize( &p->wCHORUSMOD_OnOff );
    m_cmbMODType.SetCurSel( p->wCHORUSMOD_Type );

    int i   = p->wCHORUSMOD_Type;
    int iP1 = p->wCHORUSMOD_Param1; 
    int iP2 = p->wCHORUSMOD_Param2; 
    int iP3 = p->wCHORUSMOD_Param3; 
    int iP4 = p->wCHORUSMOD_Param4; 
    int iP5 = p->wCHORUSMOD_Param5;
    int iP6 = p->wCHORUSMOD_Level;

    switch( p->wCHORUSMOD_Type )
    {
    case 0: // chorus
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 20 );    m_editMODParam3.Value = iP3 + 1;
        m_editMODParam4.Initialize( 1, 20 );    m_editMODParam4.Value = iP4 + 1;
        m_cmbMODWavFromType.SetCurSel( iP4 );
        m_editMODParam5.Initialize( -99, 99 );  m_editMODParam5.Value = iP5 - 99;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 1: // Flanger
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 2: // Phaser
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 1, 20 );    m_editMODParam4.Value = iP4 + 1;
        m_cmbMODWavFromType.SetCurSel( iP4 );
        m_editMODParam5.Initialize( -99, 99 );  m_editMODParam5.Value = iP5 - 99;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 3: // Triggered Flanger
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 4: // Triggered Phaser
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 5: // Tremolo
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 20 );    m_editMODParam3.Value = iP3 + 1;
        m_cmbMODWavFromType.SetCurSel( iP3 );
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 0 );      m_editMODLevel.Value  = iP6;
        break;
    case 6: // Panner
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 20 );    m_editMODParam3.Value = iP3 + 1;
        m_cmbMODWavFromType.SetCurSel( iP3 );
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 0 );      m_editMODLevel.Value  = iP6;
        break;
    case 7: // Vibrato
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 20 );    m_editMODParam3.Value = iP3 + 1;
        m_cmbMODWavFromType.SetCurSel( iP3 );
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 0 );      m_editMODLevel.Value  = iP6;
        break;
    case 8: // Rotary Speaker
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 200, 1500 );m_editMODParam4.Value = iP4 + 200;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 9: // AutoYa
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 50 );    m_editMODParam3.Value = iP3 + 1;
        m_editMODParam4.Initialize( -99, 99 );  m_editMODParam4.Value = iP4 - 99;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 10: // YaYa
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 1, 50 );    m_editMODParam3.Value = iP3 + 1;
        m_editMODParam4.Initialize( -99, 99 );  m_editMODParam4.Value = iP4 - 99;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 11: // SynthTalk
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( 0, 99 );    m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( -99, 99 );  m_editMODParam4.Value = iP4 - 99;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 12: // Envelope Filter
        m_editMODParam1.Initialize( 0, 99 );    m_editMODParam1.Value = iP1;
        m_editMODParam2.Initialize( 0, 99 );    m_editMODParam2.Value = iP2;
        m_editMODParam3.Initialize( -99, 99 );  m_editMODParam3.Value = iP3 - 99;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 13: // Detune
        m_editMODParam1.Initialize( -24, 24 );  m_editMODParam1.Value = iP1 - 24;
        m_editMODParam2.Initialize( -99, 99 );  m_editMODParam2.Value = iP2 - 99;
        m_editMODParam3.Initialize( 0, 0 );     m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    case 14: // Pitch Shift
        m_editMODParam1.Initialize( -12, 12 );  m_editMODParam1.Value = iP1 - 12;
        m_editMODParam2.Initialize( -99, 99 );  m_editMODParam2.Value = iP2 - 99;
        m_editMODParam3.Initialize( 0, 0 );     m_editMODParam3.Value = iP3;
        m_editMODParam4.Initialize( 0, 0 );     m_editMODParam4.Value = iP4;
        m_editMODParam5.Initialize( 0, 0 );     m_editMODParam5.Value = iP5;
        m_editMODLevel.Initialize( 0, 99 );     m_editMODLevel.Value  = iP6;
        break;
    }

    m_txtMODParam1.SetWindowText( MOD[i].lpsz1 );
    m_txtMODParam2.SetWindowText( MOD[i].lpsz2 );
    m_txtMODParam3.SetWindowText( MOD[i].lpsz3 );
    m_txtMODParam4.SetWindowText( MOD[i].lpsz4 );
    m_txtMODParam5.SetWindowText( MOD[i].lpsz5 );
    m_txtMODParam1.ShowWindow( MOD[i].iS1 );
    m_txtMODParam2.ShowWindow( MOD[i].iS2 );
    m_txtMODParam3.ShowWindow( MOD[i].iS3 );
    m_txtMODParam4.ShowWindow( MOD[i].iS4 );
    m_txtMODParam5.ShowWindow( MOD[i].iS5 );
    m_txtMODLevel.ShowWindow( MOD[i].iS6 );
    m_editMODParam1.Visible = MOD[i].iS1;
    m_editMODParam2.Visible = MOD[i].iS2;
    m_editMODParam3.Visible = MOD[i].iS3;
    m_editMODParam4.Visible = MOD[i].iS4;
    m_editMODParam5.Visible = MOD[i].iS5;
    m_editMODLevel.Visible = MOD[i].iS6;

    CGNXEdit *pWndAlignWavFrm = NULL;
    switch( MOD[i].iWavFrmPlace )
    {
    case 0:
        m_cmbMODWavFromType.ShowWindow( SW_HIDE );
        break;
    case 3:
        pWndAlignWavFrm = &m_editMODParam3;
        break;
    case 4:
        pWndAlignWavFrm = &m_editMODParam4;
        break;
    default:
        ASSERT( 0 );
        break;
    }

    if( pWndAlignWavFrm )
    {
        WINDOWPLACEMENT wpl;
        pWndAlignWavFrm->GetWindowPlacement( &wpl );
        pWndAlignWavFrm->SetVisible( FALSE );
        CRect rc;
        m_cmbActiveChannel.GetWindowRect( &rc );
        wpl.rcNormalPosition.right = wpl.rcNormalPosition.left + rc.Width();
        m_cmbMODWavFromType.SetWindowPlacement( &wpl );
        m_cmbMODWavFromType.ShowWindow( SW_SHOW );
    }
}

void CRealGNX4LibView::UpdateDelayView( LPPRESET p )
{
    m_chkDELAYEnable.Initialize( &p->wDELAY_OnOff );
    m_cmbDELAYType.SetCurSel( p->wDELAY_Type );
    m_editDELAYTime.Value          = p->wDELAY_Time;
    m_editDELAYFeedback.Value      = p->wDELAY_Feedback;
    m_editDELAYThresh.Value        = p->wDELAY_Threshould;
    m_editDELAYAttenuation.Value   = p->wDELAY_Attenuation;
    m_editDELAYBalance.Value       = p->wDELAY_LRBalance - 99;
    m_editDELAYSpread.Value        = p->wDELAY_Spread + 1;
    m_editDELAYLevel.Value         = p->wDELAY_Level;
}

void CRealGNX4LibView::UpdateReverbView( LPPRESET p )
{
    m_chkREVERBEnable.Initialize( &p->wREVERB_OnOff );
    m_cmbREVERBType.SetCurSel(   p->wREVERB_Type );
    m_editREVERBPredelay.Value = p->wREVERB_Predelay;
    m_editREVERBDecay.Value    = p->wREVERB_Decay;
    m_editREVERBDumping.Value  = p->wREVERB_Dumping;
    m_editREVERBBalance.Value  = p->wREVERB_LRBalance - 99;
    m_editREVERBLevel.Value    = p->wREVERB_Level;
}

void CRealGNX4LibView::UpdateExpPdlView( LPPRESET p )
{
    m_cmbEXPPdl1Assgn.SelectString( -1, GNXAssignCodeToStr( p->wEXPPdl1Assign ) ) ;
    m_cmbEXPPdl2Assgn.SelectString( -1, GNXAssignCodeToStr( p->wEXPPdl2Assign ) ) ;
    m_cmbEXPPdl3Assgn.SelectString( -1, GNXAssignCodeToStr( p->wEXPPdl3Assign ) ) ;
    m_editExpPdl1Min.Value = p->wEXPPdl1Min;
    m_editExpPdl1Max.Value = p->wEXPPdl1Max;
    m_editExpPdl2Min.Value = p->wEXPPdl2Min;
    m_editExpPdl2Max.Value = p->wEXPPdl2Max;
    m_editExpPdl3Min.Value = p->wEXPPdl3Min;
    m_editExpPdl3Max.Value = p->wEXPPdl3Max;
}

void CRealGNX4LibView::UpdateLFOView( LPPRESET p )
{
    m_cmbLFO1.SelectString( -1, GNXAssignCodeToStr( p->wLFO1Assign ) );
    m_cmbLFO2.SelectString( -1, GNXAssignCodeToStr( p->wLFO1Assign ) );
    m_editLFO1Min.Value = p->wLFO1Min;
    m_editLFO1Max.Value = p->wLFO1Max;
    m_cmbLFO1WavFrm.SetCurSel( p->wLFO1WaveForm );
    m_editLFO1Speed.Value = p->wLFO1Speed;
    m_editLFO2Min.Value = p->wLFO2Min;
    m_editLFO2Max.Value = p->wLFO2Max;
    m_cmbLFO2WavFrm.SetCurSel( p->wLFO2WaveForm );
    m_editLFO2Speed.Value = p->wLFO1Speed;
}

void CRealGNX4LibView::UpdateCtrlAView( LPPRESET p )
{
    m_cmbCtrlALink1Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLA_Lnk1_Assign ) ) ;
    m_cmbCtrlALink2Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLA_Lnk2_Assign ) );
    m_cmbCtrlALink3Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLA_Lnk3_Assign ) );
    m_editCtrlALink1Min.Value = p->wCTRLA_Lnk1_Min;
    m_editCtrlALink1Max.Value = p->wCTRLA_Lnk1_Max;
    m_editCtrlALink2Min.Value = p->wCTRLA_Lnk2_Min;
    m_editCtrlALink2Max.Value = p->wCTRLA_Lnk2_Max;
    m_editCtrlALink3Min.Value = p->wCTRLA_Lnk3_Min;
    m_editCtrlALink3Max.Value = p->wCTRLA_Lnk3_Max;

    if( p->wCTRLA_Type == 0 )
        CheckRadioButton( IDC_CTRLA_TOGGLE_RADIO, IDC_CTRLA_MOMENT_RADIO, IDC_CTRLA_TOGGLE_RADIO );
    else
        CheckRadioButton( IDC_CTRLA_TOGGLE_RADIO, IDC_CTRLA_MOMENT_RADIO, IDC_CTRLA_MOMENT_RADIO );
 
    m_cmbCtrlBLink1Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLB_Lnk1_Assign ) );
    m_cmbCtrlBLink2Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLB_Lnk2_Assign ) );
    m_cmbCtrlBLink3Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLB_Lnk3_Assign ) );
    m_editCtrlBLink1Min.Value = p->wCTRLB_Lnk1_Min;
    m_editCtrlBLink1Max.Value = p->wCTRLB_Lnk1_Max;
    m_editCtrlBLink2Min.Value = p->wCTRLB_Lnk2_Min;
    m_editCtrlBLink2Max.Value = p->wCTRLB_Lnk2_Max;
    m_editCtrlBLink3Min.Value = p->wCTRLB_Lnk3_Min;
    m_editCtrlBLink3Max.Value = p->wCTRLB_Lnk3_Max;

    if( p->wCTRLB_Type == 0 )
        CheckRadioButton( IDC_CTRLB_TOGGLE_RADIO, IDC_CTRLB_MOMENT_RADIO, IDC_CTRLB_TOGGLE_RADIO );
    else
        CheckRadioButton( IDC_CTRLB_TOGGLE_RADIO, IDC_CTRLB_MOMENT_RADIO, IDC_CTRLB_MOMENT_RADIO );

    m_cmbCtrlCLink1Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLC_Lnk1_Assign ) );
    m_cmbCtrlCLink2Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLC_Lnk2_Assign ) );
    m_cmbCtrlCLink3Type.SelectString( -1, GNXAssignCodeToStr( p->wCTRLC_Lnk3_Assign ) );
    m_editCtrlCLink1Min.Value = p->wCTRLC_Lnk1_Min;
    m_editCtrlCLink1Max.Value = p->wCTRLC_Lnk1_Max;
    m_editCtrlCLink2Min.Value = p->wCTRLC_Lnk2_Min;
    m_editCtrlCLink2Max.Value = p->wCTRLC_Lnk2_Max;
    m_editCtrlCLink3Min.Value = p->wCTRLC_Lnk3_Min;
    m_editCtrlCLink3Max.Value = p->wCTRLC_Lnk3_Max;

    if( p->wCTRLC_Type == 0 )
        CheckRadioButton( IDC_CTRLC_TOGGLE_RADIO, IDC_CTRLC_MOMENT_RADIO, IDC_CTRLC_TOGGLE_RADIO );
    else
        CheckRadioButton( IDC_CTRLC_TOGGLE_RADIO, IDC_CTRLC_MOMENT_RADIO, IDC_CTRLC_MOMENT_RADIO );

    UINT iCheckAmpFootswitchID = IDC_AMP_CH1_CH2_RADIO + p->wAmpChannelFootSwitch;
    CheckRadioButton( IDC_AMP_CH1_CH2_RADIO, IDC_AMP_CH1_CH2_WARP_RADIO, iCheckAmpFootswitchID );
}

void CRealGNX4LibView::OnSelChangeWhammyModule()
{
    CRealGNX4LibDoc* pDoc = GetDocument();
    LPPRESET p = pDoc->GetPreset( m_iCurrentPresetIdx );
    if( !p )
        return;   

    p->wWHAMMY_IPS_TALK_Selection = m_cmbWHAMMYModule.GetCurSel();
    UpdateWhammyModView( p );
    pDoc->SetModifiedFlag();
}

void CRealGNX4LibView::OnSelChangeStompBox()
{
    CRealGNX4LibDoc* pDoc = GetDocument();
    LPPRESET p = pDoc->GetPreset( m_iCurrentPresetIdx );
    if( !p )
        return;   

    p->wSTOMPBOX_Type = m_cmbSTOMPBOXType.GetCurSel();
    UpdateSompBoxView( p );
    pDoc->SetModifiedFlag();
}

void CRealGNX4LibView::OnSelChangeNoiseGateType()
{
    CRealGNX4LibDoc* pDoc = GetDocument();
    LPPRESET p = pDoc->GetPreset( m_iCurrentPresetIdx );
    if( !p )
        return;   

    p->wNOISEGATE_Type = m_cmbNGATEType.GetCurSel();
    UpdateNoiseGateView( p );
    pDoc->SetModifiedFlag();
}

void CRealGNX4LibView::OnSelChangeChorusModType()
{
    CRealGNX4LibDoc* pDoc = GetDocument();
    LPPRESET p = pDoc->GetPreset( m_iCurrentPresetIdx );
    if( !p )
        return;   

    p->wCHORUSMOD_Type = m_cmbMODType.GetCurSel();
    UpdateChorusModView( p );
    pDoc->SetModifiedFlag();
}